/*
 * autor: Marcin Formela
*/


package pl.formit04.mail;


import java.util.Date;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;

import javax.jdo.PersistenceManager;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class ClientStore {
	
    public ClientStore(PersistenceManager pm, String name, String email, Date date,
    		Text coment) {
		this.id = IdStore.getSeqNumber(pm, "client");
		this.name = name;
		this.email = email;
		this.date = date;	
		this.owner = EmailStore.getOwner(pm, IdStore.getSeqNumber(pm, "user"));
		this.coment = coment;
		this.sent = false;
	}


	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private int id;
    
    @Persistent
    private String name;
    
    @Persistent
    private String email;
    
	@Persistent
    private Date date;
    
	@Persistent
    private String owner;
	
    @Persistent
    private Text coment;
    
    @Persistent
    private boolean sent;
    
 

	@Override
	public String toString() {
		return "ClientStore [id=" + id + ", name=" + name + ", email=" + email
				+ ", date=" + date + ", owner=" + owner + ", coment=" + coment.getValue()
				+ "]";
	}

	public int getId(){
		return id;
	}
	
	public String getName() {
		return name;
	}

	public String getEmail() {
		return email;
	}

	public Date getDate() {
		return date;
	}
	public String getOwner() {
		return owner;
	}

	public Text getComent() {
		return coment;
	}

	public void setSent(boolean sent) {
		this.sent = sent;
	}

	public boolean isSent() {
		return sent;
	}
	

    
}